package xin.marcher.module.search.service.impl;

import org.springframework.stereotype.Service;
import xin.marcher.module.common.core.PageResult;
import xin.marcher.module.search.domain.dto.CompletionSearchWordDTO;
import xin.marcher.module.search.domain.dto.CompletionSearchWordResultDTO;
import xin.marcher.module.search.domain.request.CompletionSearchWordRequest;
import xin.marcher.module.search.domain.request.QueryCompletionSearchWordPageRequest;
import xin.marcher.module.search.repository.CompletionSearchWordRepository;
import xin.marcher.module.search.service.CompletionSearchWordService;

import javax.annotation.Resource;
import java.io.IOException;

/**
 *
 */
@Service
public class CompletionSearchWordServiceImpl implements CompletionSearchWordService {

    @Resource
    private CompletionSearchWordRepository completionSearchWordRepository;

    /**
     * 保存历史搜索词
     */
    @Override
    public CompletionSearchWordResultDTO saveCompletionSearchWord(CompletionSearchWordRequest request) throws IOException {
        return completionSearchWordRepository.saveCompletionSearchWord(request);
    }

    /**
     * 查询历史搜索词接口
     */
    @Override
    public PageResult<CompletionSearchWordDTO> listCompletionSearchWordPage(QueryCompletionSearchWordPageRequest request) throws IOException {
        return completionSearchWordRepository.listCompletionSearchWordPage(request);
    }
}
